package com.sky.mapper;

import com.sky.entity.SetmealDish;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sky.vo.DishItemVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author 马毅爽
* @description 针对表【setmeal_dish(套餐菜品关系)】的数据库操作Mapper
* @createDate 2023-11-06 16:32:20
* @Entity com.sky.entity.SetmealDish
*/
public interface SetmealDishMapper extends BaseMapper<SetmealDish> {

    List<Long> getSetmealIdByDishIds(List<Long> dishIds);

    @Select("select dish_id from setmeal_dish where setmeal_id = #{id}")
    List<Long> getDishIdBySetmealId(Long id);

    void deleteBySetmealIds(List<Long> ids);

    @Select("select s.name,s.copies,d.image,d.description from setmeal_dish s left join dish d on s.dish_id = d.id where setmeal_id = #{id};")
    List<DishItemVO> queryDishById(Long id);

    @Delete("delete from setmeal_dish where setmeal_id = #{id}")
    void removeBySetmealId(Long id);
}




